package com.link.base.base.duty.controller;


import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.link.base.base.duty.model.DutyClient;
import com.link.base.base.duty.service.DutyClientService;
import com.link.core.basic.annotations.JsonParam;
import com.link.core.basic.query.QueryParams;
import com.link.core.cllog.LCLogger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.link.core.basic.controller.BasicController;
import com.link.core.basic.service.BasicService;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;
/**
 * Copyright  hande Company. All Rights Reserved.
 *
 * @author  黄龙建
 * @date:   2018-09-19
 * @version 1.0
 */

@Controller
@RequestMapping("/link/dutyclient")
public class DutyClientController extends BasicController<DutyClient> {

    @Resource
    private DutyClientService dutyClientService;

    @Override
    public BasicService<DutyClient> getBasicService() throws Exception {
        return dutyClientService;
    }


    @RequestMapping(value = "/delClientOfDuty", method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> delClientOfDuty(@JsonParam DutyClient record,@JsonParam QueryParams qps, HttpSession session,
                                               HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> result = new HashMap<String, Object>(4);
        try {
            dutyClientService.delClientOfDuty(record);
            result.put("success", true);
        } catch (Exception e) {
            LCLogger.withException(e);
            result.put("success", false);
            result.put("result", e.getMessage());
        }
        return result;
    }
}
